import { Game_Actor } from "@/objects/GameActor.js";

export class Game_Actors {
    constructor() {
        this._data = [];
    }

    actor(actorId) {
        if ($dataActors[actorId]) {
            if (!this._data[actorId]) {
                this._data[actorId] = new Game_Actor(actorId);
            }
            return this._data[actorId];
        }
        return null;
    }

    serialize(){
        return this._data.map(a=>a.serialize());
    }

    deserialize(data){
        this._data=data.map(a=>{
            let ga=new Game_Actor();
            ga.deserialize(a);
            return ga;
        });
    }
}